home *** CD-ROM | disk | FTP | other *** search
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
-
- main()
- {
- char *pc;
- char ev[] = "test=1234";
-
- if (putenv(ev) == -1)
- printf("cannot define string\n");
- else {
- printf("string definition added\n");
- pc = getenv("test");
- printf("string defined as >%s<\n", pc);
-
- ev[6] = 'x';
- pc = getenv("test");
- printf("string defined as >%s<\n", pc);
-
- strcpy(ev, "xyz");
- pc = getenv("test");
- if (pc == NULL)
- printf("no such string\n");
- else
- printf("string defined as >%s<\n", pc);
- system("see");
- }
- }
-
- string definition added
- string defined as >1234<
- string defined as >1x34<
- no such string
-
-